package fr.axones.pocketagile.vo
{	
	import mx.collections.ArrayCollection;

	[Bindable]
	[RemoteClass]
	public class ProjectItemVO
	{
		public var id:Number;
		public var projectId:Number;
		
		public var name:String;
		public var value:int;
		
		public function ProjectItemVO()
		{
		}
		
		public static function builds(a:Array):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			
			for each(var o:Object in a)
			{
				ac.addItem(buildObject(o));
			}			
			
			return ac;
		}
		
		public static function build(s:String):ProjectItemVO
		{
			var o:Object = JSON.parse(s);
			
			return buildObject(o);
		}
		
		public static function buildObject(o:Object):ProjectItemVO
		{
			var item:ProjectItemVO = new ProjectItemVO();
			
			for (var propertyName:String in o)
			{
				item[propertyName] = o[propertyName];
			}
			
			return item;
		}
	}
}